Skip to content

Handle si7021 returning negative humidity #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tiberiusteng
Copy link

@tiberiusteng tiberiusteng commented Jul 15, 2024

si7021_env::humidityBasisPoints is unsigned int, but SI7021::getHumidityBasisPoints is returning a value ranged from -600 ... 11900 inclusive, where negative values will underflow to 64936 ... 65535.

struct Payload::humidity is signed integer and we don't want to modify si7021 library, so we just cast it as signed integer when doing conversion.

Here's one of my emonTH presenting this behavior; my location is constantly very humid so I suspect it has been driven into an extreme state. I'm going to play with built-in heater of si7021 to see if I can make it properly report humidity again.

firefox_znR4vX1xLV

`si7021_env::humidityBasisPoints` is `unsigned int`, but `SI7021::getHumidityBasisPoints` is returning a value ranged from -600 ... 11900 inclusive, where negative values will underflow to 64936 ... 65535.

`struct Payload::humidity` is signed integer and we don't want to modify si7021 library, so we just pad the value when doing conversion, where calculation is done in (signed) floating point.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant